<?php
if (getenv("HTTP_X_FORWARDED_FOR")){
$ip = getenv("HTTP_X_FORWARDED_FOR");
$client = gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']);
  } else {
$ip = getenv("REMOTE_ADDR");
$client = gethostbyaddr($_SERVER['REMOTE_ADDR']);
   }
$str = preg_split("/\./", $client);
$i = count($str);
$x = $i - 1;
$n = $i - 2;
$isp = $str[$n] . "." . $str[$x];
echo $ip;
echo ':'.$isp;
echo ':'.$client;
?> 
